home *** CD-ROM | disk | FTP | other *** search
- Path: chronicle.mti.sgi.com!austern
- From: "Paul D. DeRocco" <pderocco@ix.netcom.com>
- Newsgroups: comp.std.c++
- Subject: Re: typedef not strong
- Date: 20 Feb 1996 10:50:00 PST
- Organization: Netcom
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <31285017.4BFA@ix.netcom.com>
- References: <4g5sm4$dtt@natasha.rmii.com> <r4d97clcgj.fsf@erawan.cognex.com>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: Mon, 19 Feb 1996 05:25:27 -0500
- X-Netcom-Date: Mon Feb 19 2:31:58 AM PST 1996
- X-Mailer: Mozilla 2.0b6a (Win95; I)
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMSoX50y4NqrwXLNJAQFA9AH+Kvise9NNXDiQ2MkcWpK/CaByz/J8yKon
- slJK7PWhWTWelYjtOXQp9KF6Btt9Ov/0e60tYBhGuqpCzoEE+Yol3Q==
- =tTZY
- Originator: austern@isolde.mti.sgi.com
-
- The disadvantage of "class" is that it creates a structure type. If you
- want to create a new arithmetic type, you can do that with "class", but
- you have to define all the arithmetic operators over again, using
- inlines. The Borland compiler, for one, will let you do that, but it
- will never generate code quite as efficient as it will for the built-in
- types, where it is happy to do arithmetic (addition and subtraction, at
- least) in whatever registers are most convenient.
-
- Perhaps we need a syntax like:
-
- class myint: public int;
- class specialint: public myint;
-
- so a myint could be used where an int was expected, and a specialint
- could be used where a myint was expected.
-
- But as soon as we do that, people will want to specify valid ranges for
- the types, a la Ada, which adds another whole level of complexity.
-
- --
-
- Ciao,
- Paul D. DeRocco
- ---
- [ To submit articles: Try just posting with your newsreader. If that fails,
- use mailto:std-c++@ncar.ucar.edu
- FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
- Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
- Comments? mailto:std.c++-request@ncar.ucar.edu
- ]
-